<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 自定义CSS样式 -->
    <link rel="stylesheet"
          href="${pageContext.request.contextPath}/assets/css/reset.css">
    <style>
        .typewriter {
            display: inline-block;
            overflow: hidden;
            border-right: .10em solid rgb(0, 0, 0);
            animation: blink-caret 1s step-end infinite;
        }

        @keyframes blink-caret {
            from, to { border-color: transparent; }
            50% { border-color: rgb(0, 0, 0); }
        }
        .container{
            display: flex;
            height: 60vh;
            justify-content: center;
            align-items: center;
        }
        h1{
            font-size: 60px;
            color: #444444;
        }
    </style>
</head>
<body>
<div class="container">
    <h1 id="text" class="typewriter"></h1>
</div>

<script>
    const text = "欢迎${sessionScope.u.userName}来到简易进销存";
    let index = 0;
    function type() {
        document.getElementById('text').textContent += text[index];
        index++;
        if (index < text.length) {
            setTimeout(type, 100); // 控制打字速度
        }
    }
    type();
</script>
</body>
</html>
